package com.artPreter.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.artPreter.pojo.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface UserMapper extends BaseMapper<User> {
    @Select("select * from jv_user where username=#{username}")
    User findByUserName(String username);

    @Insert("insert into jv_user(username,password,create_time,update_time,uuid)" +
            " values(#{username},#{password},now(),now(),#{uuid})")
    void add(String username, String password,String uuid);

    @Update("update jv_user set user_pic=#{avatarUrl},update_time=now() where id=#{id}")
    void updateAvatar(String avatarUrl,Integer id);

    @Update("update jv_user set password=#{md5String},update_time=now() where id=#{id}")
    void updatePwd(String md5String, Integer id);

}
